import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/layout/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/index.vue'),
      hidden: true
    },
    {
      path: '/',
      name: 'dashboard',
      component: Layout,
      children: [
        {
          path: '/dashboard',
          component: () => import('@/views/dashboard/index.vue'),
          meta: { title: '工作台', icon: '' }
        }
      ]
    },
    {
      path: '/thread',
      component: Layout,
      children: [
        {
          path: '/thread',
          component: () => import('@/views/thread/index.vue'),
          meta: { title: '线索管理', icon: '' }
        }
      ]
    },
    {
      path: '/business',
      component: Layout,
      children: [
        {
          path: '/business',
          component: () => import('@/views/business/index.vue'),
          meta: { title: '商机管理', icon: '' }
        }
      ]
    },
    {
      path: '/contract',
      component: Layout,
      children: [
        {
          path: '/contract',
          component: () => import('@/views/contract/index.vue'),
          meta: { title: '合同管理', icon: '' }
        }
      ]
    },
    {
      path: '/basicData',
      component: Layout,
      meta: { title: '基础数据管理', icon: '' },
      children: [
        {
          path: '/basicData/course',
          component: () => import('@/views/basicData/course/index.vue'),
          meta: { title: '课程管理', icon: '' }
        },
        {
          path: '/basicData/activity',
          component: () => import('@/views/basicData/activity/index.vue'),
          meta: { title: '活动管理', icon: '' }
        }
      ]
    },
    {
      path: '/statistics',
      component: Layout,
      children: [
        {
          path: '/statistics',
          component: () => import('@/views/statistics/index.vue'),
          meta: { title: '统计分析', icon: '' }
        }
      ]
    },
    {
      path: '/system',
      component: Layout,
      meta: { title: '系统管理', icon: '' },
      children: [
        {
          path: '/system/inform',
          component: () => import('@/views/system/inform/index.vue'),
          meta: { title: '通知中心', icon: '' }
        },
        {
          path: '/system/jurisdiction',
          redirect: '/system/jurisdiction/user',
          meta: { title: '权限管理', icon: '' },
          children: [
            {
              path: '/system/jurisdiction/user',
              component: () => import('@/views/system/jurisdiction/user/index.vue'),
              meta: { title: '用户管理', icon: '' }
            },
            {
              path: '/system/jurisdiction/role',
              component: () => import('@/views/system/jurisdiction/role/index.vue'),
              meta: { title: '角色管理', icon: '' }
            },
            {
              path: '/system/jurisdiction/menu',
              component: () => import('@/views/system/jurisdiction/menu/index.vue'),
              meta: { title: '菜单管理', icon: '' }
            },
            {
              path: '/system/jurisdiction/department',
              component: () => import('@/views/system/jurisdiction/department/index.vue'),
              meta: { title: '部门管理', icon: '' }
            },
            {
              path: '/system/jurisdiction/post',
              component: () => import('@/views/system/jurisdiction/post/index.vue'),
              meta: { title: '岗位管理', icon: '' }
            }
          ]
        },
        {
          path: '/system/dictionaries',
          component: () => import('@/views/system/dictionaries/index.vue'),
          meta: { title: '字典管理', icon: '' }
        },
        {
          path: '/system/threadAlocation',
          component: () => import('@/views/system/threadAlocation/index.vue'),
          meta: { title: '线索配置', icon: '' }
        },
        {
          path: '/system/businessAlocation',
          component: () => import('@/views/system/businessAlocation/index.vue'),
          meta: { title: '商机配置', icon: '' }
        },
        {
          path: '/system/systemLog',
          component: () => import('@/views/system/systemLog/index.vue'),
          meta: { title: '系统日志', icon: '' }
        }
      ]
    }
  ]
})

export default router
